#!/bin/bash

export sqoop_txt=$1
export HADOOP_HOME=$2
export HADOOP_COMMON_HOME=$2
export HADOOP_MAPRED_HOME=$2
export DB_CONN=$3
export DB_USER=$4
export DB_PASS=$5
export HIVE_HOME=$6
export HCAT_HOME=$7
export PATITION=$8
for f in $HIVE_HOME/lib/*.jar; do
  if [ "$HADOOP_CLASSPATH" ]; then
    export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$f
  else
    export HADOOP_CLASSPATH=$f
  fi
done
echo "the hadoop classpath is ${HADOOP_CLASSPATH}"

/usr/local/azkaban/sqoop_bin/bin/sqoop --options-file $sqoop_txt --hcatalog-partition-keys "dt" --hcatalog-partition-values "$PATITION" --password $DB_PASS --username $DB_USER --connect $DB_CONN
